.class Lcom/alipay/android/app/util/FileDownloader$1;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic this$0:Lcom/alipay/android/app/util/FileDownloader;

.field private final synthetic val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;


# direct methods
.method constructor <init>(Lcom/alipay/android/app/util/FileDownloader;Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;)V
    .locals 0

    iput-object p1, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    iput-object p2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 8

    const-wide/16 v6, 0x0

    const/4 v5, 0x0

    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    new-instance v1, Lcom/alipay/android/app/util/FileFetch;

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fileUrl:Ljava/lang/String;
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$3(Lcom/alipay/android/app/util/FileDownloader;)Ljava/lang/String;

    move-result-object v2

    iget-object v3, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->savePath:Ljava/lang/String;
    invoke-static {v3}, Lcom/alipay/android/app/util/FileDownloader;->access$4(Lcom/alipay/android/app/util/FileDownloader;)Ljava/lang/String;

    move-result-object v3

    iget-object v4, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    invoke-direct {v1, v2, v3, v4}, Lcom/alipay/android/app/util/FileFetch;-><init>(Ljava/lang/String;Ljava/lang/String;Lcom/alipay/android/app/util/FileDownloader;)V

    #setter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v0, v1}, Lcom/alipay/android/app/util/FileDownloader;->access$5(Lcom/alipay/android/app/util/FileDownloader;Lcom/alipay/android/app/util/FileFetch;)V

    const-wide/16 v0, -0x1

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    iget-boolean v2, v2, Lcom/alipay/android/app/util/FileDownloader;->showProgress:Z

    if-eqz v2, :cond_0

    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #calls: Lcom/alipay/android/app/util/FileDownloader;->getFileSize()J
    invoke-static {v0}, Lcom/alipay/android/app/util/FileDownloader;->access$6(Lcom/alipay/android/app/util/FileDownloader;)J

    move-result-wide v0

    cmp-long v2, v0, v6

    if-gtz v2, :cond_1

    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;

    invoke-virtual {v0, v5}, Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;->sendEmptyMessage(I)Z

    :goto_0
    return-void

    :cond_0
    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #calls: Lcom/alipay/android/app/util/FileDownloader;->deleteFile()V
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$2(Lcom/alipay/android/app/util/FileDownloader;)V

    :cond_1
    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    iget-boolean v2, v2, Lcom/alipay/android/app/util/FileDownloader;->showProgress:Z

    if-eqz v2, :cond_2

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #calls: Lcom/alipay/android/app/util/FileDownloader;->readTempFile()V
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$7(Lcom/alipay/android/app/util/FileDownloader;)V

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$1(Lcom/alipay/android/app/util/FileDownloader;)Lcom/alipay/android/app/util/FileFetch;

    move-result-object v2

    invoke-virtual {v2}, Lcom/alipay/android/app/util/FileFetch;->getFileEnd()J

    move-result-wide v2

    cmp-long v2, v2, v0

    if-eqz v2, :cond_2

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #calls: Lcom/alipay/android/app/util/FileDownloader;->deleteFile()V
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$2(Lcom/alipay/android/app/util/FileDownloader;)V

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$1(Lcom/alipay/android/app/util/FileDownloader;)Lcom/alipay/android/app/util/FileFetch;

    move-result-object v2

    invoke-virtual {v2, v6, v7}, Lcom/alipay/android/app/util/FileFetch;->setFileStart(J)V

    iget-object v2, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v2}, Lcom/alipay/android/app/util/FileDownloader;->access$1(Lcom/alipay/android/app/util/FileDownloader;)Lcom/alipay/android/app/util/FileFetch;

    move-result-object v2

    invoke-virtual {v2, v0, v1}, Lcom/alipay/android/app/util/FileFetch;->setFileEnd(J)V

    :cond_2
    new-instance v0, Ljava/lang/Thread;

    iget-object v1, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v1}, Lcom/alipay/android/app/util/FileDownloader;->access$1(Lcom/alipay/android/app/util/FileDownloader;)Lcom/alipay/android/app/util/FileFetch;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;

    #setter for: Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;->isFinished:Z
    invoke-static {v0, v5}, Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;->access$1(Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;Z)V

    :goto_1
    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->this$0:Lcom/alipay/android/app/util/FileDownloader;

    #getter for: Lcom/alipay/android/app/util/FileDownloader;->fetch:Lcom/alipay/android/app/util/FileFetch;
    invoke-static {v0}, Lcom/alipay/android/app/util/FileDownloader;->access$1(Lcom/alipay/android/app/util/FileDownloader;)Lcom/alipay/android/app/util/FileFetch;

    move-result-object v0

    invoke-virtual {v0}, Lcom/alipay/android/app/util/FileFetch;->isStop()Z

    move-result v0

    if-eqz v0, :cond_3

    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;

    invoke-virtual {v0, v5}, Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;->sendEmptyMessage(I)Z

    goto :goto_0

    :cond_3
    const-wide/16 v0, 0x5dc

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_2
    iget-object v0, p0, Lcom/alipay/android/app/util/FileDownloader$1;->val$output:Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;

    invoke-virtual {v0, v5}, Lcom/alipay/android/app/util/FileDownloader$ProgressOutput;->sendEmptyMessage(I)Z

    goto :goto_1

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_2
.end method
